package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.constant.MessageConstant;
import com.itheima.pojo.CheckItem;
import com.itheima.service.CheckItemService;
import com.itheima.utils.Result;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author ifredomvip@gmail.com
 * @Date 2022/5/12 17:08
 * @Version 1.0.0
 * @Description 检查项管理
 **/

@RestController
@RequestMapping("/checkitem")
public class CheckItemController {

    @Reference
    private CheckItemService checkItemService;

    @RequestMapping("/add")
    public Result addItem(@RequestBody CheckItem checkItem) {
        try {
            checkItemService.add(checkItem);

        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false, MessageConstant.ADD_CHECKITEM_FAIL);
        }

        return new Result(false, MessageConstant.ADD_CHECKITEM_SUCCESS);
    }
}
